package com.bidevalution.support.context;

import org.apache.log4j.Logger;
import com.qtp.core.util.GsonUtil;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;

public class ChannelContext {
	private String accessToken;
	private ChannelHandlerContext channelHandlerContext;
	private Logger logger = Logger.getLogger(getClass());
	public ChannelContext(String accessToken,ChannelHandlerContext channelHandlerContext) {
		this.channelHandlerContext = channelHandlerContext;
		this.accessToken = accessToken;
	}

	public ChannelHandlerContext getChannelHandlerContext() {
		return channelHandlerContext;
	}
	public void sendMessage(ResponseObject responseObject) {
		channelHandlerContext.channel().writeAndFlush(new TextWebSocketFrame(GsonUtil.toJson(responseObject)));
	}

	public String getAccessToken() {
		return accessToken;
	}

}
